package com.jx.jingxuan.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.GridLayout;

import com.facebook.drawee.view.SimpleDraweeView;
import com.jx.jingxuan.R;
import com.jx.jingxuan.fres.CoreImageLoader;

/**
 * <li>Package:com.jx.jingxuan.widget</li>
 * <li>Author: Administrator  </li>
 * <li>Date: 2019/3/19</li>
 * <li>Description:   </li>
 */
public class HomeIconGridView extends GridLayout {
    public HomeIconGridView(Context context) {
        super(context);
        init();
    }

    public HomeIconGridView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public HomeIconGridView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }


    private void init() {
        for (int i = 0; i < 10; i++) {
            addOne(i);
        }
    }

    private void addOne(final int i) {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.home_icon, this);
        SimpleDraweeView simpleDraweeView = view.findViewById(R.id.home_icon_iv);
        simpleDraweeView.setId(i);
        CoreImageLoader.loadImage(simpleDraweeView, "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552985029120&di=b7a27287ecc4fdae946f44cd0165540a&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F01%2F19%2F39%2F40570b09774307e.jpg");
    }
}
